<%@tag import="com.hrms.core.Utils"%>
<%@ attribute name="label" required="true" rtexprvalue="true"%>
<%@ attribute name="input" required="false" rtexprvalue="true"%>
<%@ attribute name="type" required="false" rtexprvalue="true"%>
<%@ attribute name="name" required="false" rtexprvalue="true"%>
<%@ attribute name="value" required="false" rtexprvalue="true"%>
<%@ attribute name="maxlen" required="false" rtexprvalue="true"%>
<%@ attribute name="datefield" required="false" rtexprvalue="true"%>
<%@ attribute name="timefield" required="false" rtexprvalue="true"%>
<%@ attribute name="size" required="false" rtexprvalue="true"%>
<%@ attribute name="readonly" required="false" rtexprvalue="true"%>
<%@ attribute name="rows" required="false" rtexprvalue="true"%>

<tr class="listtablerowodd">
	<td><font class="listtablecellemphasis"><%=label%></font></td>
	<td class="datafieldlabel">
	<%
		if (type != null) {
			boolean isTxtArea=type.equalsIgnoreCase("textarea");
		if(isTxtArea){%>
		<textarea rows="<%=rows%>"  cols="40" onkeydown="countText(this)" onblur="countText(this)"			
		<% }else{ %>
		<input type="<%=type%>"	 value="<%=value%>" 
		<%}%>  
		name="<%=name%>" id="<%=name%>" <%= Utils.getAttrValue("maxlength", maxlen) %>
			<%= Utils.getAttrValue("size", size)  %>
			<%=datefield!=null ? " class=\"DatePicker\"" : "" %>
			<%= readonly!=null ? "readonly" : "" %>		
		<% if(isTxtArea){
			out.print(">"+value+"</textarea>");			
				if(maxlen!=null){
					out.print("<label id=\"lbl"+name+"\"><font class='sectionheaderadditionaltextalert'>chars left :"+ (Integer.parseInt(maxlen) - value.length()) +"</font></label>");
			} 
		}else { out.print("/>"); } %>
		<%=input != null ? input : ""%> 
<% } else {
 		out.print(input);
 	}
  	if (datefield != null) {
  %> <script type="text/javascript">
  		$(document).ready(function(){
    			$("#<%=name%>").datepicker({ showOn: 'button', buttonImageOnly: true, buttonImage: '/static/images/icon_cal.png' });
  		});
</script>
<%
	}else if (timefield != null) {
%>
<IMG SRC="/static/timepicker/images/timepicker.gif" BORDER="0" ALT="Pick a Time!" ONCLICK="selectTime(this,<%=name%>)" STYLE="cursor:hand"/>
<% } %>
	</td>
</tr>
